<template>
  <div class="admin-login_item2">
    <div class="items-left">
      <div class="items-left_ibox">
        <img :src="logo" v-if="logo" />
      </div>
      <div class="items-left_text">{{themeRoute.name}}</div>
    </div>
    <div class="items-right">
      <div class="items-right_box">
        <div class="box_text">登入</div>
        <div class="box_intro">输入你的用户名与密码</div>
        <div class="items-right_ipt">
          <input class="ipt-li" v-model="user.username" placeholder="用户名" />
          <input class="ipt-li" type="password" v-model="user.password" placeholder="密码" />
        </div>
        <div class="right_box-buts">
          <el-button class="buts-action" @click="subimt" :loading="loading">登录</el-button>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
  export default {
    props: {
      themeRoute: {}
    },
    data () {
      return {
        loading: false,
        logo: null,
        user: {
          username: '',
          password: ''
        }
      }
    },
    mounted () {
      this.init()
    },
    methods: {
      async init () {
        this.logo = await this.$api.configLogo()
      },
      async subimt () {
        this.loading = true
        await this.$ala.userLogin(this.user)
        this.loading = false
      }
    }
  }
</script>
<style lang="scss">
  .admin-login_item2 {
    width: 100%;
    height: 100%;
    min-width: 1200px;
    display: flex;
    flex-direction: row;
    .items-left {
      width: 40%;
      height: 100%;
      background: url("../../../../../static/img/bg-4.jpg") no-repeat;
      background-size: 1200px 100%;
      position: relative;
      .items-left_ibox {
        padding: 50px 40px;
        img {
          width: 112px;
          height: 90px;
        }
      }
      .items-left_text {
        font-weight: 400;
        line-height: 1.2;
        font-size: 26px;
        color: #ffffff;
        padding: 0 40px;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
      }
    }
    .items-right {
      flex: 1;
      min-width: 0;
      position: relative;
      .items-right_box {
        width: 400px;
        display: flex;
        flex-direction: column;
        align-items: center;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        .box_text {
          font-size: 26px;
          font-weight: 500;
          color: #3f4254;
        }
        .box_intro {
          font-size: 14px;
          color: #b5b5c3;
          margin-top: 10px;
        }
        .items-right_ipt {
          display: flex;
          flex-direction: column;
          width: 100%;
          margin-top: 40px;
          .ipt-li {
            background-color: #f3f6f9;
            outline: none;
            line-height: 1.5;
            padding: 18px;
            margin-top: 20px;
            border-radius: 6px;
            font-size: 13px;
          }
          .ipt-li::-webkit-input-placeholder {
            color: #cccccc;
          }
          .ipt-li:focus {
            background-color: #ebedf3;
          }
        }
        .right_box-buts {
          width: 100%;
          display: flex;
          align-items: center;
          justify-content: flex-end;
          margin-top: 40px;
          .buts-action {
            background-color: #8950fc;
            color: #ffffff;
            padding: 16px 28px;
            border-radius: 8px;
          }
          .buts-action:hover {
            background-color: #7337ee;
          }
        }
      }
    }
  }
</style>